# -*- coding: utf-8 -*-
from sqlalchemy import Column, BIGINT, String, Text, SmallInteger
from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()

class ConversationLog(Base):
    __tablename__ = 'conversation_log'

    id = Column(BIGINT, primary_key=True, autoincrement=True)
    question = Column(Text, nullable=False)
    thinking = Column(Text)
    response = Column(Text)
    user_id = Column(String(50), nullable=False)  # 用于标识对话记录所属的用户
    # 关键词
    keyword = Column(String(50))
    # 是否内置 0:内置和1新增的
    is_builtin = Column(SmallInteger, default=1)

    def __repr__(self):
        return f"<ConversationLog(id={self.id}, question={self.question}, thinking={self.thinking}, response={self.response}, user_id={self.user_id}, keyword={self.keyword}, is_builtin={self.is_builtin})>"